const Switch = {
    state: {
        isShowBaseChoice: false,
        isShowBaseChoiceInput: JSON.parse(window.sessionStorage.getItem('isShowBaseChoiceInput') || false),

        isShowProcessChoice: false,
        isShowProcessChoiceInput: JSON.parse(window.sessionStorage.getItem('isShowProcessChoiceInput') || false), 

        isShowSlaughterChocie: false,
        isShowSlaughterChocieInput: JSON.parse(window.sessionStorage.getItem('isShowSlaughterChocieInput') || false), 
    },
      
    mutations: {
        showBaseChoice(state) {
            state.isShowBaseChoice = true
        },
        closeBaseChoice(state) {
            state.isShowBaseChoice = false
        },
        isShowBaseChoice(state, currentPlace) {
            if( currentPlace === 'Dovecote'|| currentPlace === 'Info_Manage' || currentPlace === 'Video_Manage') {
                state.isShowBaseChoice = true
            } else {
                // console.log(123);
                state.isShowBaseChoice = false
            }
        },
        isShowBaseChoiceInput(state, currentPlace) {
            if( currentPlace === 'Dovecote' || currentPlace === 'Video_Manage' ) {
                state.isShowBaseChoiceInput = true
                window.sessionStorage.setItem('isShowBaseChoiceInput', true)
            } else {
                state.isShowBaseChoiceInput = false
                window.sessionStorage.setItem('isShowBaseChoiceInput', false)
            }
        },


        showProcessChoice(state) {
            state.isShowProcessChoice = true
        },
        closeProcessChoice(state) {
            state.isShowProcessChoice = false
        },
        isShowProcessChoice(state, currentPlace) {
            if( currentPlace === 'Process' ) {
                state.isShowProcessChoice = true
                window.sessionStorage.setItem('isShowProcessChoiceInput', true)
            } else {
                state.isShowProcessChoice = false
                window.sessionStorage.setItem('isShowProcessChoiceInput', false)
            }
        },
        isShowProcessChoiceInput(state, currentPlace) {
            if( currentPlace === 'Process' ) {
                state.isShowProcessChoiceInput = true
            } else {
                state.isShowProcessChoiceInput = false
            }
        },

        showSlaughterChocie(state) {
            state.isShowSlaughterChocie = true
        },
        closeSlaughterChocie(state) {
            state.isShowSlaughterChocie = false
        },
        isShowSlaughterChocie(state, currentPlace) {
            if( currentPlace === 'Slaughter' ) {
                state.isShowSlaughterChocie = true
                window.sessionStorage.setItem('isShowSlaughterChocieInput', true)
            } else {
                state.isShowSlaughterChocie = false
                window.sessionStorage.setItem('isShowSlaughterChocieInput', false)
            }
        },
        isShowSlaughterChocieInput(state, currentPlace) {
            if( currentPlace === 'Slaughter' ) {
                state.isShowSlaughterChocieInput = true
            } else {
                state.isShowSlaughterChocieInput = false
            }
        }
    }
}
export default Switch